package com.yoso.shop.interfaces.controller.gatewaytest;

import com.yoso.base.interfaces.controller.BaseResponse;
import com.yoso.shop.application.service.ICommodityBranchService;
import com.yoso.shop.infrastructure.cache.CommodityCacheServer;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author shizejin
 * @date 2022/7/14
 * @description:
 */
@RestController
@Slf4j
@RequestMapping("gateway")
public class GateWayTest {
    @Autowired
    private ICommodityBranchService commodityBranchService;
    @Autowired
    private CommodityCacheServer commodityCacheServer;

    @ApiOperation("获得商品分支信息")
    @GetMapping("get")
    public BaseResponse<Map<String, Object>> getMasterBranchToBranchMap() {
        Map<String, Object> commodityBranchCacheMap = commodityCacheServer.getCommodityBranchCacheMap();
        return BaseResponse.success("操作成功！", commodityBranchCacheMap);
    }
}
